<template>
<view class="page share div">
  <view class="page__bd div">
    <view class="weui-tab div">
      <view class="weui-tab__panel div">
        <view class="weui-panel weui-panel_access div">
          <view class="weui-panel__bd div">
            <text> 方式一：点击右上角 "..." 按钮，分享到群！ </text>
            <view class="img div">
              <image src="" alt class="img"></image>
            </view>
          </view>
        </view>
        <view class="weui-panel weui-panel_access div">
          <view class="weui-panel__bd div">
            <text> 方式二：点击下图“保存图片”，分享到朋友圈。 </text>
            <view class="img div">
              <view class="div">
                <text>{{activity.title}}</text>
              </view>
              <image :src="activity.code" :data-preview="activity.code" @tap="onPreviewImage" alt class="qr-img img"></image>
            </view>
          </view>
        </view>
      </view>
    </view>
  </view>
</view>
</template>

<script>
var app = getApp();

export default {
  data() {
    return {
      activity: {}
    };
  },

  components: {},
  props: {},
  onLoad: function (request) {
    var $this = this;

    if (request.id) {
      app.globalData.util.request({
        url: 'entry/wxapp/detail',
        data: {
          m: 'rcdonkey_signup',
          id: request.id
        },
        method: 'post',
        success: function (response) {
          $this.setData({
            'activity': response.data.data
          });
        }
      });
    }
  },
  onShareAppMessage: function () {
    var $this = this;
    return {
      title: $this.data.activity.title,
      path: '/rcdonkey_signup/pages/detail/detail?id=' + $this.data.activity.id,
      success: function (res) {}
    };
  },
  methods: {
    onPreviewImage: function (event) {
      app.globalData.util.showImage(event);
    }
  }
};
</script>
<style>
@import "./share.css";
</style>